import request from '@/utils/request'

export function getRolePermissionList(params) {
  return request({
    url: '/admin/auth/permission',
    method: 'get',
    params
  })
}

export function addOneRolePermission(datas) {
  return request({
    url: '/admin/auth/permission',
    method: 'post',
    data: datas
  })
}

export function getRolePermissionByID(idObj) {
  const { id } = idObj
  return request({
    url: `/admin/auth/permission/${id}`,
    method: 'get'
  })
}

export function updateOneRolePermission(datas) {
  return request({
    url: '/admin/auth/permission',
    method: 'put',
    data: datas
  })
}

export function deleteOneRolePermission(idObj) {
  const { id } = idObj
  return request({
    url: `/admin/auth/permission/${id}`,
    method: 'delete'
  })
}
